package com.example.javatwo.controller.xs.lyh;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.javatwo.pojo.xs.lyh.hissalesVo;
import com.example.javatwo.pojo.xs.lyh.historycheck;
import com.example.javatwo.pojo.xs.lyh.pageBean;
import com.example.javatwo.pojo.xs.lyh.salesorders;
import com.example.javatwo.service.xs.lyh.SalesOrderBizImpl;

@Controller
public class TextContrlyhs {
	
	@Autowired
	private SalesOrderBizImpl sbiz;
	
	@RequestMapping("/SalesOrders")
	public String SalesOrders() throws Exception{
		return "xs/lyh/SalesOrders";
	}
	
	
	@ResponseBody
	@RequestMapping("/querySalelyh")
	public pageBean querylyh(@RequestParam Map<String, Object> map) throws Exception{
		pageBean pb=this.sbiz.querySalelyh(map);
		return pb;
	}
	
	@ResponseBody
	@RequestMapping("/insertSaleslyh")
	public void insertSaleslyh(@RequestBody salesorders sales) throws Exception{
		this.sbiz.insertSaleslyh(sales);
	}
	
	@ResponseBody
	@RequestMapping("/updateSaleslyh")
	public void updateSaleslyh(@RequestBody salesorders sales) throws Exception{
		this.sbiz.updateSaleslyh(sales);
	}
	
	@ResponseBody
	@RequestMapping("/updateShenHelyh")
	public void updateShenHelyh(String isShenHe,String billNo) throws Exception{
		this.sbiz.updateShenHelyh(isShenHe, billNo);
	}
	
	/**
	 * 销售订单：在我点击保存的时候对(历史查询记录)=》进行新增
	 * 但是如果客户第一次购买就不显示第二次显示
	 * @param his
	 */
	@ResponseBody
	@RequestMapping("/insertHistoryChecklyh")
	public void insertHistoryChecklyh(@RequestBody historycheck his) throws Exception{
		//System.out.println(his);
		this.sbiz.insertHistoryChecklyh(his);
	}
	
	@ResponseBody
	@RequestMapping("/queryhissalesVolyh")
	public List<hissalesVo> queryhissalesVolyh(String customerID) throws Exception{
		//System.out.println(this.sbiz.queryhissalesVolyh(customerID));
		return this.sbiz.queryhissalesVolyh(customerID);
	}
}
